

<!DOCTYPE html>
<html lang='zh-cn'>
<head>
  <meta charset='utf-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <title>添加项目 - 禅道</title>
  <script>window.config={"webRoot":"\/zentao\/","debug":false,"appName":"","cookieLife":30,"requestType":"PATH_INFO","requestFix":"-","moduleVar":"m","methodVar":"f","viewVar":"t","defaultView":"html","themeRoot":"\/zentao\/theme\/","currentModule":"project","currentMethod":"create","clientLang":"zh-cn","requiredFields":"name,code,begin,end","router":"\/zentao\/index.php","save":"\u4fdd\u5b58","runMode":"","timeout":30000,"pingInterval":""};
  window.lang={"submitting":"\u7a0d\u5019...","save":"\u4fdd\u5b58","expand":"\u5c55\u5f00\u5168\u90e8","timeout":"\u8fde\u63a5\u8d85\u65f6\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u73af\u5883\uff0c\u6216\u91cd\u8bd5\uff01"};

  </script>
  <script>config.onlybody = "no";</script><link rel='stylesheet' href='/zentao/theme/default/zh-cn.default.css?v=12.5.3' type='text/css' media='screen' />
  <script src='/zentao/js/all.js?v=12.5.3'></script>
  <style>.mgr-5px{margin-right:5px;}
  #productsBox .col-sm-3{margin-bottom:5px;}
  #productsBox .input-group {table-layout: fixed; width: 100%;}
  #productsBox .has-branch select {width: 100%; display: table-cell; border-radius: 0 2px 2px 0; border-left: none;}
  #productsBox .has-branch select:focus {box-shadow: inset 1px 0 #4d90fe}
  #productsBox .input-group-addon {display: none;}
  #productsBox .input-group.has-branch > select[name*="product"] + .chosen-container {width: 60%!important;}
  #productsBox .input-group.has-branch > select[name*="branch"] + .chosen-container {width: 40%!important;}
  #productsBox .input-group.has-branch > select[name*="product"] + .chosen-container .chosen-single {border-radius: 2px 0 0 2px;}
  #productsBox .input-group.has-branch > select[name*="branch"] + .chosen-container .chosen-single {border-radius: 0 2px 2px 0; border-left-width: 0; padding-left: 9px;}
  #productsBox .input-group.has-branch > select[name*="branch"] + .chosen-container.chosen-container-active  .chosen-single {border-left-width: 1px; padding-left: 8px;}

  .table-children {border-left: 2px solid #cbd0db; border-right: 2px solid #cbd0db;}
  .table tbody > tr.table-children.table-child-top {border-top: 2px solid #cbd0db;}
  .table tbody > tr.table-children.table-child-bottom {border-bottom: 2px solid #cbd0db;}
  .table td.has-child > a:not(.task-toggle) {max-width: 90%; max-width: calc(100% - 30px); display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
  .table td.has-child > .task-toggle {color: #838a9d; position: relative; top: 1px; line-height: 16px;}
  .table td.has-child > .task-toggle:hover {color: #006af1; cursor: pointer;}
  .table td.has-child > .task-toggle > .icon {font-size: 16px; display: inline-block; transition: transform .2s; -ms-transform:rotate(-90deg); -moz-transform:rotate(-90deg); -o-transform:rotate(-90deg); -webkit-transform:rotate(-90deg); transform: rotate(-90deg);}
  .table td.has-child > .task-toggle > .icon:before {text-align: left;}
  .table td.has-child > .task-toggle.collapsed {top: 2px}
  .table td.has-child > .task-toggle.collapsed > .icon {-ms-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -webkit-transform:rotate(90deg); transform: rotate(90deg);}
  .main-table tbody > tr.table-children > td:first-child::before {width: 3px;}
  @-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;}}

  .chosen-container-single .chosen-single > span{max-width: 300px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}

  #whitelistBox .checkbox-inline, #whitelistBox .radio-inline{margin-left: 10px; display: inline-block; padding-left: 0px; padding-right: 10px;}
  .main-table > .table-responsive {padding: 0 1px; background: #fff;}
  #tipsModal {margin-top: 10%;}
  .chosen-container-single .chosen-single > span{max-width:100%;}

  #copyProjectModal {padding: 0}
  #copyProjectModal {padding: 0 2px}
  #copyProjectModal > div {position: relative;}
  #copyProjectModal a {display: block; min-height: 30px; line-height: 30px; padding: 5px 15px; border: 1px solid #e5e5e5; color: #333; margin: 5px 0; border-radius: 3px;}
  #copyProjectModal a > i {display: inline-block; margin-right: 5px;}
  #copyProjectModal a:hover {border:1px solid #00a9fc; background-color: #E9F2FB; text-decoration: none}
  #copyProjectModal a.active {border-color: #00da88; color: #00da88; background-color: #E5FFE6}
  #copyProjectModal a.active:after {position: absolute; content: '\e92f'; font-family: ZentaoIcon; font-size: 20px; right: 25px;}
  #copyProjectModal a.cancel {color: #ff5d5d}

  .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {margin-top: 1px;}

  .type-tips {display: none;}
  </style><link rel='icon' href='/zentao/favicon.ico' type='image/x-icon' />
  <link rel='shortcut icon' href='/zentao/favicon.ico' type='image/x-icon' />
  <!--[if lt IE 10]>
  <script src='/zentao/js/jquery/placeholder/min.js?v=12.5.3'></script>
  <![endif]-->
</head>
<body>
<style>
  .picker-single .picker-selection-remove{z-index: 1000;}
  .picker-selection-single:after, .picker-multi.picker-focus .picker-selections:before{font-family: ZentaoIcon !important; content: '\f0d7' !important;}
</style>
<script>
  var chooseUsersToMail = '选择要发信通知的用户...';
  if($.fn.picker)
  {
    $(document).ready(function()
    {
      $(".picker-select[data-pickertype!='remote']").picker({chosenMode: true});
      $("[data-pickertype='remote']").each(function()
      {
        var pickerremote = $(this).attr('data-pickerremote');
        $(this).picker({chosenMode: true, remote: pickerremote});
      })
    });
  }
</script>
<header id='header'>
  <div id='mainHeader'>
    <div class='container'>
      <hgroup id='heading'>
        <h1 id='companyname' title='易软天创'><a href='/temp/index' >易软天创</a>
        </h1>
      </hgroup>
      <nav id='navbar'><ul class='nav nav-default'>
        <li  data-id='my'><a href="/index/ind2" ><span> 我的地盘</span></a></li>
        <li  data-id='product'><a href='/temp/product-index-no' >产品</a></li>
        <li class='active' data-id='project'><a href='/temp/project-index-no' class='active'>项目</a></li>
        <li  data-id='qa'><a href='/temp/product-showErrorNone-qa' >测试</a></li>
        <li class='divider'></li><li  data-id='ci'><a href='/temp/repo-browse' >集成</a></li>
        <li  data-id='doc'><a href='/temp/doc' >文档</a></li>
        <li  data-id='report'><a href='/temp/report-productSummary' >统计</a></li>
        <li class='divider'></li><li  data-id='company'><a href='/temp/company-browse' >组织</a></li>
        <li  data-id='admin'><a href='/temp/admin' >后台</a></li>
      </ul>
      </nav>
      <div id='toolbar'>
        <div id="userMenu">
          <div id='searchbox'><div class='input-group'><div class='input-group-btn'><a data-toggle='dropdown' class='btn btn-link'><span id='searchTypeName'>项目</span> <span class='caret'></span></a><input type='hidden' name='searchType' id='searchType' value='project'  />
            <ul id='searchTypeMenu' class='dropdown-menu'><li ><a href='javascript:$.setSearchType("bug");' data-value='bug'>Bug</a></li><li ><a href='javascript:$.setSearchType("story");' data-value='story'>需求</a></li><li ><a href='javascript:$.setSearchType("task");' data-value='task'>任务</a></li><li ><a href='javascript:$.setSearchType("testcase");' data-value='testcase'>用例</a></li><li class='selected'><a href='javascript:$.setSearchType("project");' data-value='project'>项目</a></li><li ><a href='javascript:$.setSearchType("product");' data-value='product'>产品</a></li><li ><a href='javascript:$.setSearchType("user");' data-value='user'>用户</a></li><li ><a href='javascript:$.setSearchType("build");' data-value='build'>版本</a></li><li ><a href='javascript:$.setSearchType("release");' data-value='release'>发布</a></li><li ><a href='javascript:$.setSearchType("productplan");' data-value='productplan'>产品计划</a></li><li ><a href='javascript:$.setSearchType("testtask");' data-value='testtask'>测试单</a></li><li ><a href='javascript:$.setSearchType("doc");' data-value='doc'>文档</a></li><li ><a href='javascript:$.setSearchType("caselib");' data-value='caselib'>用例库</a></li><li ><a href='javascript:$.setSearchType("testreport");' data-value='testreport'>测试报告</a></li></ul></div><input id='searchInput' class='form-control search-input' type='search' onclick='this.value=""' onkeydown='if(event.keyCode==13) $.gotoObject();' placeholder='编号(ctrl+g)'/></div><a href='javascript:$.gotoObject();' class='btn btn-link' id='searchGo'>GO!</a></div>
          <ul id="userNav" class="nav nav-default">
            <li><a class='dropdown-toggle' data-toggle='dropdown'><span class='user-name'>admin</span><span class='caret'></span></a><ul class='dropdown-menu pull-right'><li class="user-profile-item"><a href='/temp/my-profile' class=' no-role'><div class='avatar avatar bg-secondary avatar-circle'>A</div>
              <div class="user-profile-name">admin</div><div class="user-profile-role"></div></a></li><li class="divider"></li><li><a href='/temp/my-profile' >个人档案</a>
            </li><li><a href='/temp/my-changepassword' class='iframe' data-width='500'>更改密码</a>
            </li><li class='divider'></li><li class='dropdown-submenu'><a href='javascript:;'>主题</a><ul class='dropdown-menu pull-left'><li class='selected'><a href='javascript:selectTheme("default");' data-value='default'>禅道蓝（默认）</a></li><li ><a href='javascript:selectTheme("green");' data-value='green'>叶兰绿</a></li><li ><a href='javascript:selectTheme("red");' data-value='red'>赤诚红</a></li><li ><a href='javascript:selectTheme("purple");' data-value='purple'>玉烟紫</a></li><li ><a href='javascript:selectTheme("pink");' data-value='pink'>芙蕖粉</a></li><li ><a href='javascript:selectTheme("blackberry");' data-value='blackberry'>露莓黑</a></li><li ><a href='javascript:selectTheme("classic");' data-value='classic'>经典蓝</a></li></ul></li><li class='dropdown-submenu'><a href='javascript:;'>Language</a><ul class='dropdown-menu pull-left'><li class='selected'><a href='javascript:selectLang("zh-cn");'>简体</a></li><li ><a href='javascript:selectLang("zh-tw");'>繁體</a></li><li ><a href='javascript:selectLang("en");'>English</a></li><li ><a href='javascript:selectLang("de");'>Deutsch</a></li><li ><a href='javascript:selectLang("fr");'>Français</a></li><li ><a href='javascript:selectLang("vi");'>Tiếng Việt</a></li><li ><a href='javascript:selectLang("ja");'>日本語</a></li></ul></li><li class='custom-item'><a href='custom-ajaxMenu-project-index.html?onlybody=yes' data-toggle='modal' data-type='iframe' data-icon='cog' data-width='80%'>自定义导航</a></li><li class="divider"></li><li class='dropdown-submenu'><a data-toggle='dropdown'>帮助</a><ul class='dropdown-menu pull-left'><li><a href='tutorial-start.html' class='iframe' data-class-name='modal-inverse' data-width='800' data-headerless='true' data-backdrop='true' data-keyboard='true'>新手教程</a>
            </li><li><a href='https://www.zentao.net/book/zentaopmshelp.html?fullScreen=zentao' class='open-help-tab' target='_blank' rel='noopener noreferrer'>手册</a>
            </li><li><a href='/temp/misc-changeLog' class='iframe' data-width='800' data-headerless='true' data-backdrop='true' data-keyboard='true'>修改日志</a>
            </li></ul></li>
              <li><a href='/temp/misc-about' class='about iframe' data-width='1050' data-headerless='true' data-backdrop='true' data-keyboard='true' data-class='modal-about'>关于禅道</a>
              </li><li class="divider"></li><li><a href='/temp/user-logout' >退出</a>
              </li></ul></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div id='subHeader'>
    <div class='container'>
      <div id="pageNav" class='btn-toolbar'><div class="btn-group angle-btn"><div class="btn-group"><button data-toggle="dropdown" type="button" class="btn">添加项目 <span class="caret"></span></button><ul class="dropdown-menu"><li><a href='/zentao/project-index-no.html' ><i class="icon icon-home"></i> 项目主页</a>
      </li><li><a href='/zentao/project-all-all.html' ><i class="icon icon-cards-view"></i> 所有项目</a>
      </li><li><a href='/zentao/project-create.html' ><i class="icon icon-plus"></i> 添加项目</a>
      </li></ul></div></div><div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='测试项目'>测试项目 <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='/zentao/project-ajaxGetDropMenu-1-project-create-.html'><div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div></div></div></div></div>
      <nav id='subNavbar'><ul class='nav nav-default'>
        <li class=' ' data-id='task'><a href='/zentao/project-task-1.html' >任务</a>
        </li>
        <li class=' ' data-id='kanban'><a href='/zentao/project-kanban-1.html' >看板</a>
        </li>
        <li class=' ' data-id='burn'><a href='/zentao/project-burn-1.html' >燃尽图</a>
        </li>
        <li class='dropdown dropdown-hover ' data-id='list'><a href='/zentao/project-grouptask-1.html' >更多<span class='caret'></span></a>
          <ul class='dropdown-menu'><li class='' data-id='groupTask'><a href='/zentao/project-groupTask-1.html' >分组视图</a>
          </li><li class='' data-id='tree'><a href='/zentao/project-tree-1.html' >树状图</a>
          </li></ul></li>
        <li class='divider'></li><li class=' ' data-id='story'><a href='/zentao/project-story-1.html' >需求</a>
      </li>
        <li class='dropdown dropdown-hover ' data-id='qa'><a href='/zentao/project-bug-1.html' >测试<span class='caret'></span></a>
          <ul class='dropdown-menu'><li class='' data-id='bug'><a href='/zentao/project-bug-1.html' >Bug</a>
          </li><li class='' data-id='build'><a href='/zentao/project-build-1.html' >版本</a>
          </li><li class='' data-id='testtask'><a href='/zentao/project-testtask-1.html' >测试单</a>
          </li></ul></li>
        <li class=' ' data-id='doc'><a href='/zentao/doc-objectLibs-project-1-project.html' >文档</a>
        </li>
        <li class='divider'></li><li class=' ' data-id='team'><a href='/zentao/project-team-1.html' >团队</a>
      </li>
        <li class='dropdown dropdown-hover ' data-id='action'><a href='/zentao/project-dynamic-1.html' >动态</a>
        </li>
        <li class='divider'></li><li class=' ' data-id='product'><a href='/zentao/project-manageproducts-1.html' >产品</a>
      </li>
        <li class=' ' data-id='view'><a href='/zentao/project-view-1.html' >概况</a>
        </li>
      </ul>
      </nav>
      <div id="pageActions"><div class='btn-toolbar'></div></div>
    </div>
  </div>
</header>

<main id='main'  >
  <div class='container'>
    <script src='/zentao/js/kindeditor/kindeditor.min.js?v=12.5.3'></script>
    <script src='/zentao/js/kindeditor/lang/zh_CN.js?v=12.5.3'></script>
    <script>
      (function($) {
        var kuid = '60c948b302154';
        var editor = {"id":["desc"],"tools":"simpleTools"};
        var K = KindEditor;

        var bugTools =
                [ 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic','underline', '|',
                  'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|',
                  'emoticons', 'image', 'code', 'link', '|', 'removeformat','undo', 'redo', 'fullscreen', 'source', 'about'];
        var simpleTools =
                [ 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic','underline', '|',
                  'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|',
                  'emoticons', 'image', 'code', 'link', 'table', '|', 'removeformat','undo', 'redo', 'fullscreen', 'source', 'about'];
        var fullTools =
                [ 'formatblock', 'fontname', 'fontsize', 'lineheight', '|', 'forecolor', 'hilitecolor', '|', 'bold', 'italic','underline', 'strikethrough', '|',
                  'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|',
                  'insertorderedlist', 'insertunorderedlist', '|',
                  'emoticons', 'image', 'insertfile', 'hr', '|', 'link', 'unlink', '/',
                  'undo', 'redo', '|', 'selectall', 'cut', 'copy', 'paste', '|', 'plainpaste', 'wordpaste', '|', 'removeformat', 'clearhtml','quickformat', '|',
                  'indent', 'outdent', 'subscript', 'superscript', '|',
                  'table', 'code', '|', 'pagebreak', 'anchor', '|',
                  'fullscreen', 'source', 'preview', 'about'];
        var editorToolsMap = {fullTools: fullTools, simpleTools: simpleTools, bugTools: bugTools};

        // Kindeditor default options
        var editorDefaults =
                {
                  cssPath: [config.themeRoot + 'zui/css/min.css'],
                  width: '100%',
                  height: '200px',
                  filterMode: true,
                  bodyClass: 'article-content',
                  urlType: 'absolute',
                  uploadJson: createLink('file', 'ajaxUpload', 'uid=' + kuid),
                  langType: 'zh_CN',
                  cssData: 'html,body {background: none}.article-content{overflow:visible}.article-content, .article-content table td, .article-content table th {line-height: 1.3846153846; font-size: 13px;}.article-content .table-auto {width: auto!important; max-width: 100%;}',
                  placeholder: "\u53ef\u4ee5\u5728\u7f16\u8f91\u5668\u76f4\u63a5\u8d34\u56fe\u3002",
                  placeholderStyle: {fontSize: '13px', color: '#888'},
                  pasteImage: {postUrl: createLink('file', 'ajaxPasteImage', 'uid=' + kuid)},
                  syncAfterBlur: true,
                  spellcheck: false
                };

        window.editor = {};

        // Init kindeditor
        var setKindeditor = function(element, options)
        {
          var $editor  = $(element);
          var pasted   = false;
          var editorID = $editor.attr('id');
          options      = $.extend({}, editorDefaults, $editor.data(), options);
          if(editorID === undefined)
          {
            editorID = 'kindeditor-' + $.zui.uuid();
            $editor.attr('id', editorID);
          }

          var editorTool  = editorToolsMap[options.tools || editor.tools] || simpleTools;

          /* Remove fullscreen in modal. */
          if(config.onlybody == 'yes')
          {
            var newEditorTool = new Array();
            for(i in editorTool)
            {
              if(editorTool[i] != 'fullscreen') newEditorTool.push(editorTool[i]);
            }
            editorTool = newEditorTool;
          }

          $.extend(options,
                  {
                    items: editorTool,
                    placeholder: $editor.attr('placeholder') || options.placeholder || '',
                    pasteImage: {postUrl: createLink('file', 'ajaxPasteImage', 'uid=' + kuid), placeholder: $editor.attr('placeholder') || "\u53ef\u4ee5\u5728\u7f16\u8f91\u5668\u76f4\u63a5\u8d34\u56fe\u3002"},
                  });

          try
          {
            var keditor = K.create('#' + editorID, options);
            window.editor['#'] = window.editor[editorID] = keditor;
            $editor.data('keditor', keditor);
            return keditor;
          }
          catch(e){return false;}
        };

        // Init kindeditor with jquery way
        $.fn.kindeditor = function(options)
        {
          return this.each(function()
          {
            setKindeditor(this, options);
          });
        };

        // Init all kindeditor
        var initKindeditor = function(afterInit)
        {
          var $submitBtn = $('form :input[type=submit]');
          if($submitBtn.length)
          {
            $submitBtn.next('#uid').remove();
            $submitBtn.after("<input type='hidden' id='uid' name='uid' value=" + kuid + ">");
          }
          if($.isFunction(afterInit)) afterInit();
          $.each(editor.id, function(key, editorID)
          {
            setKindeditor('#' + editorID);
          });
        };

        // Init all kindeditors when document is ready
        $(initKindeditor);
      }(jQuery));
    </script>
    <script src='/zentao/js/misc/date.js?v=12.5.3'></script>
    <script>weekend = 2;</script>
    <script>holders = {"code":"\u56e2\u961f\u5185\u90e8\u7684\u7b80\u79f0","totalLeft":"\u9879\u76ee\u5f00\u59cb\u65f6\u7684\u603b\u9884\u8ba1\u5de5\u65f6"};</script>
    <script>errorSameProducts = "\u9879\u76ee\u4e0d\u80fd\u5173\u8054\u591a\u4e2a\u76f8\u540c\u7684\u4ea7\u54c1\u3002";</script>
    <script>productID = 0;</script>
    <div id='mainContent' class='main-content'>
      <div class='center-block'>
        <div class='main-header'>
          <h2>添加项目</h2>
          <div class="pull-right btn-toolbar">
            <button type='button' class='btn btn-link' data-toggle='modal' data-target='#copyProjectModal'><i class='icon-copy muted'></i> 复制项目</button>
          </div>
        </div>
        <form class='form-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform'>
          <table class='table table-form'>
            <tr>
              <th class='w-120px'>项目名称</th>
              <td class="col-main"><input type='text' name='name' id='name' value='' class='form-control' required autocomplete="off" />
              </td>
              <td></td><td></td>
            </tr>
            <tr>
              <th>项目代号</th>
              <td><input type='text' name='code' id='code' value='' class='form-control' required autocomplete="off" />
              </td><td></td><td></td>
            </tr>
            <tr>
              <th>起始日期</th>
              <td>
                <div class='input-group'>
                  <input type='text' name='begin' id='begin' value='2021-06-16' class='form-control form-date' onchange='computeWorkDays()' placeholder='开始日期' required autocomplete="off" />
                  <span class='input-group-addon'>至</span>
                  <input type='text' name='end' id='end' value='' class='form-control form-date' onchange='computeWorkDays()' placeholder='截止日期' required autocomplete="off" />
                </div>
              </td>
              <td colspan='2'><label class='radio-inline'><input type='radio' name='delta' value='7' onclick='computeEndDate(this.value)' id='delta7' /> 一星期</label><label class='radio-inline'><input type='radio' name='delta' value='14' onclick='computeEndDate(this.value)' id='delta14' /> 两星期</label><label class='radio-inline'><input type='radio' name='delta' value='31' onclick='computeEndDate(this.value)' id='delta31' /> 一个月</label><label class='radio-inline'><input type='radio' name='delta' value='62' onclick='computeEndDate(this.value)' id='delta62' /> 两个月</label><label class='radio-inline'><input type='radio' name='delta' value='93' onclick='computeEndDate(this.value)' id='delta93' /> 三个月</label><label class='radio-inline'><input type='radio' name='delta' value='186' onclick='computeEndDate(this.value)' id='delta186' /> 半年</label><label class='radio-inline'><input type='radio' name='delta' value='365' onclick='computeEndDate(this.value)' id='delta365' /> 一年</label></td>
            </tr>
            <tr>
              <th>可用工作日</th>
              <td>
                <div class='input-group'>
                  <input type='text' name='days' id='days' value='' class='form-control' autocomplete="off" />
                  <span class='input-group-addon'>天</span>
                </div>
              </td><td></td><td></td>
            </tr>
            <tr>
              <th>团队名称</th>
              <td><input type='text' name='team' id='team' value='' class='form-control' autocomplete="off" />
              </td><td></td><td></td>
            </tr>
            <tr>
              <th>项目类型</th>
              <td><select name='type' id='type' class='form-control' onchange='showTypeTips()'>
                <option value='sprint' title='短期项目' data-keys='duanqixiangmu dqxm'>短期项目</option>
                <option value='waterfall' title='长期项目' data-keys='zhangqixiangmu zqxm'>长期项目</option>
                <option value='ops' title='运维项目' data-keys='yunweixiangmu ywxm'>运维项目</option>
              </select>
              </td>
              <td class='muted' colspan='2'><div class='type-tips'>运维项目没有需求、bug、版本、测试功能。</div></td>
            </tr>
            <tr class='hide'>
              <th>项目状态</th>
              <td><input type='hidden' name='status' id='status' value='wait'  />
              </td>
              <td></td>
              <td></td>
            </tr>
            <tr >
              <th>关联产品</th>
              <td class='text-left' id='productsBox' colspan="3">
                <div class='row'>
                  <div class='col-sm-4'>
                    <div class='input-group'>
                      <select name='products[0]' id='products0' class='form-control chosen' onchange='loadBranches(this)'>
                        <option value='0' title='' data-keys=' '></option>
                      </select>
                      <span class='input-group-addon fix-border'></span>
                    </div>
                  </div>
                </div>
              </td>
            </tr>
            <tr >
              <th>关联计划</th>
              <td colspan="3" id="plansBox">
                <div class='row'>
                  <div class="col-sm-4" id="plan0"><select name='plans[]' id='plans' class='form-control chosen'>
                    <option value='0' title='' data-keys=' '></option>
                  </select>
                  </div>
                  <script>currentPlanID = "";</script>
                </div>
              </td>
            </tr>
            <tr>
              <th>项目描述</th>
              <td colspan='3'>
                <style>
                  #tplBoxWrapper {position: relative; z-index: 10;}
                  #tplBoxWrapper > .btn-toolbar {position: absolute; right: 1px; top: 1px;}
                  #tplBoxWrapper .btn {padding: 4px 8px; border-top:0px; border-bottom:0px;}
                  #tplBoxWrapper #applyTplBtn {border-right:0px;}
                  #tplBox li {position: relative;}
                  #tplBox li .btn-delete {position: absolute; right: 0; top: -5px; display: block; width: 40px; text-align:center;}
                  #tplBox li:hover .btn-delete {color:#fff;}
                  #tplBox li .tpl-name {padding-right: 40px;}
                </style>
                <div id='tplBoxWrapper'>
                  <div class='btn-toolbar'>
                    <div class='btn-group'>
                      <button id='saveTplBtn' type='button' class='btn btn-mini' data-toggle='saveTplModal'>保存模板</button>
                      <button id='applyTplBtn' type='button' class='btn btn-mini dropdown-toggle' data-toggle='dropdown'>应用模板 <span class='caret'></span></button>
                      <ul id='tplBox' class='dropdown-menu pull-right'>
                      </ul>
                    </div>
                  </div>
                </div>
                <div class="modal fade" id="saveTplModal" tabindex="-1" role="dialog">
                  <div class="modal-dialog w-600px">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><i class="icon icon-close"></i></button>
                        <h4 class="modal-title">请输入模板标题</h4>
                      </div>
                      <div class="modal-body">
                        <div class='input-group'>
                          <input type="text" id="title" value="" class="form-control" autocomplete="off">
                          <span class="input-group-addon">
            <div class="checkbox-primary">
              <input type="checkbox" value="1" id="public" />
              <label for="public">公共</label>
            </div>
          </span>
                          <span class='input-group-btn'> <button type='button' class='btn btn-primary' id='templateSubmit'>保存</button></span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <script>
                  function setTemplate(templateID)
                  {
                    $('#tplBox .list-group-item.active').removeClass('active');
                    $('#tplTitleBox' + templateID).closest('.list-group-item').addClass('active');
                    var content = $('#template' + templateID).html();
                    var cmd     = editor['desc'].edit.cmd;
                    editor['desc'].html('');
                    cmd.inserthtml(content);
                    editor['desc'].templateHtml = editor['desc'].html();
                  }

                  function deleteTemplate(templateID)
                  {
                    if(!templateID) return;
                    if(confirm("\u60a8\u786e\u8ba4\u8981\u5220\u9664\u8be5\u6a21\u677f\u5417\uff1f"))
                    {
                      hiddenwin.location.href = createLink('user', 'ajaxDeleteTemplate', 'templateID=' + templateID);
                      $('#tplBox' + templateID).addClass('hidden');
                    }
                  }

                  function displayXIcon(templateID)
                  {
                    $('#templateID' + templateID).removeClass('hidden');
                  }

                  function hideXIcon(templateID)
                  {
                    $('#templateID' + templateID).addClass('hidden');
                  }

                  $(function()
                  {
                    $('#saveTplModal').on('hide.zui.modal', function(){$(this).find('#title').val('');});
                    $('#saveTplBtn').click(function()
                    {
                      var content = editor['desc'].html();
                      if(!content)
                      {
                        bootAlert("模板内容不能为空!");
                        return;
                      }
                      $('#saveTplModal').modal('show');
                    });
                    $('#saveTplModal #templateSubmit').click(function()
                    {
                      var $inputGroup = $('#saveTplModal div.input-group');
                      var $publicBox  = $inputGroup.find('input#public');
                      var title       = $inputGroup.find('#title').val();
                      var content     = editor['desc'].html();
                      var isPublic    = ($publicBox.size() > 0 && $publicBox.prop('checked')) ? $publicBox.val() : 0;
                      if(!title || !content) return;
                      saveTemplateLink = "\/zentao\/user-ajaxSaveTemplate-project.html";
                      $.post(saveTemplateLink, {title:title, content:content, public:isPublic}, function(data)
                      {
                        $('#tplBox').html(data);
                        // If has error then not hide.
                        if(data.indexOf('alert') == -1) $('#saveTplModal').modal('hide');
                      });
                    });
                  })
                </script>
                <textarea name='desc' id='desc' rows='6' class='form-control kindeditor' hidefocus='true'></textarea>
              </td>
            </tr>
            <tr>
              <th>访问控制</th>
              <td colspan='3'><div class='radio'><label><input type='radio' name='acl' value='open'  checked ='checked'onclick='setWhite(this.value);' id='aclopen' /> 默认设置(有项目视图权限，即可访问)</label></div><div class='radio'><label><input type='radio' name='acl' value='private' onclick='setWhite(this.value);' id='aclprivate' /> 私有项目(只有项目团队成员才能访问)</label></div><div class='radio'><label><input type='radio' name='acl' value='custom' onclick='setWhite(this.value);' id='aclcustom' /> 自定义白名单(团队成员和白名单的成员可以访问)</label></div></td>
            </tr>
            <tr id='whitelistBox' class='hidden'>
              <th>分组白名单</th>
              <td colspan='3'><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='1'  id='whitelist1' /> <label for='whitelist1'>管理员</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='2'  id='whitelist2' /> <label for='whitelist2'>研发</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='3'  id='whitelist3' /> <label for='whitelist3'>测试</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='4'  id='whitelist4' /> <label for='whitelist4'>项目经理</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='5'  id='whitelist5' /> <label for='whitelist5'>产品经理</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='6'  id='whitelist6' /> <label for='whitelist6'>研发主管</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='7'  id='whitelist7' /> <label for='whitelist7'>产品主管</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='8'  id='whitelist8' /> <label for='whitelist8'>测试主管</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='9'  id='whitelist9' /> <label for='whitelist9'>高层管理</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='10'  id='whitelist10' /> <label for='whitelist10'>其他</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='11'  id='whitelist11' /> <label for='whitelist11'>guest</label></div><div class='checkbox-primary checkbox-inline'><input type='checkbox' name='whitelist[]' value='12'  id='whitelist12' /> <label for='whitelist12'>受限用户</label></div></td>
            </tr>
            <tr>
              <td colspan='4' class='text-center form-actions'>
                <button type='submit' id='submit' class='btn btn-wide btn-primary'  data-loading='稍候...'>保存</button>            <a href='javascript:history.go(-1);' class='btn btn-back btn-wide' >返回</a>                      </td>
            </tr>
          </table>
        </form>
      </div>
    </div>
    <div class='modal fade modal-scroll-inside' id='copyProjectModal'>
      <div class='modal-dialog mw-900px'>
        <div class='modal-header'>
          <button type='button' class='close' data-dismiss='modal'><i class="icon icon-close"></i></button>
          <h4 class='modal-title' id='myModalLabel'>请选择一个项目来复制</h4>
        </div>
        <div class='modal-body'>
          <div id='copyProjects' class='row'>
            <div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='1' class='nobr '><i class='icon-stack text-muted'></i> 测试项目</a></div>
          </div>
        </div>
      </div>
    </div>
  </div><script>
  $.initSidebar();
</script>

  <iframe frameborder='0' name='hiddenwin' id='hiddenwin' scrolling='no' class='debugwin hidden'></iframe>

</main><footer id='footer'>
  <div class="container">
    <ul class='breadcrumb'><li><a href='/zentao/my/' >禅道</a>
    </li><li><a href='/zentao/project/' >项目</a>
    </li><li class='active'>添加项目</li></ul>    <div id='poweredBy'>
    <small class='muted'><a href='https://api.zentao.net/goto.php?item=aiux' class='link-aiux' target='_blank'>Designed by <strong>艾体验</strong></a></small> &nbsp;
    <a href='https://www.zentao.net' target='_blank'><i class='icon-zentao'></i> 禅道12.5.3</a> &nbsp;
    <a href='https://api.zentao.net/goto.php?item=proversion&from=footer' target='_blank' id='proLink' class='text-important'>专业版 <i class='text-danger icon-pro-version'></i></a> &nbsp;           </div>
  </div>
</footer>
<div id="noticeBox"></div>
<script>
  /* Alert got messages. */
  needPing = false;
  $(function()
  {
    var windowBlur = false;
    if(window.Notification)
    {
      window.onblur  = function(){windowBlur = true;}
      window.onfocus = function(){windowBlur = false;}
    }
    setInterval(function()
    {
      $.get(createLink('message', 'ajaxGetMessage', "windowBlur=" + (windowBlur ? '1' : '0')), function(data)
      {
        if(!windowBlur)
        {
          $('#noticeBox').append(data);
          adjustNoticePosition();
        }
        else
        {
          if(data)
          {
            if(typeof data == 'string') data = $.parseJSON(data);
            if(typeof data.message == 'string') notifyMessage(data);
          }
        }
      });
    }, 300000);
  })

</script>

<script>function setWhite(acl)
{
  acl == 'custom' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}

function switchStatus(projectID, status)
{
  if(status) location.href = createLink('project', 'task', 'project=' + projectID + '&type=' + status);
}

function switchGroup(projectID, groupBy)
{
  link = createLink('project', 'groupTask', 'project=' + projectID + '&groupBy=' + groupBy);
  location.href=link;
}

/**
 * Convert a date string like 2011-11-11 to date object in js.
 *
 * @param  string $date
 * @access public
 * @return date
 */
function convertStringToDate(dateString)
{
  dateString = dateString.split('-');
  return new Date(dateString[0], dateString[1] - 1, dateString[2]);
}

/**
 * Compute delta of two days.
 *
 * @param  string $date1
 * @param  string $date1
 * @access public
 * @return int
 */
function computeDaysDelta(date1, date2)
{
  date1 = convertStringToDate(date1);
  date2 = convertStringToDate(date2);
  delta = (date2 - date1) / (1000 * 60 * 60 * 24) + 1;

  weekEnds = 0;
  for(i = 0; i < delta; i++)
  {
    if((weekend == 2 && date1.getDay() == 6) || date1.getDay() == 0) weekEnds ++;
    date1 = date1.valueOf();
    date1 += 1000 * 60 * 60 * 24;
    date1 = new Date(date1);
  }
  return delta - weekEnds;
}

/**
 * Compute work days.
 *
 * @access public
 * @return void
 */
function computeWorkDays(currentID)
{
  isBactchEdit = false;
  if(currentID)
  {
    index = currentID.replace('begins[', '');
    index = index.replace('ends[', '');
    index = index.replace(']', '');
    if(!isNaN(index)) isBactchEdit = true;
  }

  if(isBactchEdit)
  {
    beginDate = $('#begins\\[' + index + '\\]').val();
    endDate   = $('#ends\\[' + index + '\\]').val();
  }
  else
  {
    beginDate = $('#begin').val();
    endDate   = $('#end').val();
  }

  if(beginDate && endDate)
  {
    if(isBactchEdit)  $('#dayses\\[' + index + '\\]').val(computeDaysDelta(beginDate, endDate));
    if(!isBactchEdit) $('#days').val(computeDaysDelta(beginDate, endDate));
  }
  else if($('input[checked="true"]').val())
  {
    computeEndDate();
  }
}

/**
 * Compute the end date for project.
 *
 * @param  int    $delta
 * @access public
 * @return void
 */
function computeEndDate(delta)
{
  beginDate = $('#begin').val();
  if(!beginDate) return;

  delta     = parseInt(delta);
  beginDate = convertStringToDate(beginDate);
  if((delta == 7 || delta == 14) && (beginDate.getDay() == 1))
  {
    delta = (weekend == 2) ? (delta - 2) : (delta - 1);
  }

  endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd');
  $('#end').val(endDate).datetimepicker('templates.update');
  computeWorkDays();
}

/**
 * Load branches.
 *
 * @param  int $product
 * @access public
 * @return void
 */
function loadBranches(product)
{
  $('#productsBox select').each(function()
  {
    var $product = $(product);
    if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id'))
    {
      alert(errorSameProducts);
      $product.val(0);
      $product.trigger("chosen:updated");
      return false;
    }
  });

  if($('#productsBox .input-group:last select:first').val() != 0)
  {
    var length = $('#productsBox .input-group').size();
    $('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html() + '</div>');
    if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
    $('#productsBox .input-group:last .chosen-container').remove();
    $('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
    $('#productsBox .input-group:last .chosen').chosen();

    adjustProductBoxMargin();
  }

  var $inputgroup = $(product).closest('.input-group');
  if($inputgroup.find('select').size() >= 2) $inputgroup.removeClass('has-branch').find('select:last').remove();
  if($inputgroup.find('.chosen-container').size() >= 2) $inputgroup.find('.chosen-container:last').remove();

  var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
  $.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val()), function(data)
  {
    if(data)
    {
      $inputgroup.addClass('has-branch').append(data);
      $inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).attr('onchange', "loadPlans('#products" + index + "', this.value)").chosen();
    }
  });

  loadPlans(product);
}

function loadPlans(product, branchID)
{
  if($('#plansBox').size() == 0) return false;

  var productID = $(product).val();
  var branchID  = typeof(branchID) == 'undefined' ? 0 : branchID;
  var index     = $(product).attr('id').replace('products', '');

  if(productID != 0)
  {
    if(typeof(planID) == 'undefined') planID = 0;
    planID = $("select#plans" + productID).val() != '' ? $("select#plans" + productID).val() : planID;
    $.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=' + branchID + '&planID=' + planID + '&fieldID&needCreate=&expired=' + ((config.currentMethod == 'create' || config.currentMethod == 'edit') ? 'unexpired' : '')), function(data)
    {
      if(data)
      {
        if($("div#plan" + index).size() == 0) $("#plansBox .row").append('<div class="col-sm-4" id="plan' + index + '"></div>');
        $("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID).chosen();

        adjustPlanBoxMargin();
      }
    });
  }
}


function adjustProductBoxMargin()
{
  var productRows = Math.ceil($('#productsBox > .row > .col-sm-4').length / 3);
  if(productRows > 1)
  {
    for(i = 1; i <= productRows - 1; i++)
    {
      $('#productsBox .col-sm-4:lt(' + (i * 3) + ')').css('margin-bottom', '10px');
    }
  }
}

function adjustPlanBoxMargin()
{
  var planRows = Math.ceil($('#plansBox > .row > .col-sm-4').length / 3);
  if(planRows > 1)
  {
    for(j = 1; j <= planRows - 1; j++)
    {
      $('#plansBox .col-sm-4:lt(' + (j * 3) + ')').css('margin-bottom', '10px');
    }
  }
}

function loadBranch(){}

/* Auto compute the work days. */
$(function()
{
  $(".date").bind('dateSelected', function()
  {
    computeWorkDays(this.id);
  })
});

$(function()
{
  $(document).on('click', '.task-toggle', function(e)
  {
    var $toggle = $(this);
    var id = $(this).data('id');
    var isCollapsed = $toggle.toggleClass('collapsed').hasClass('collapsed');
    $toggle.closest('[data-ride="table"]').find('tr.parent-' + id).toggle(!isCollapsed);

    e.stopPropagation();
    e.preventDefault();
  });

  adjustProductBoxMargin();
  adjustPlanBoxMargin();
});
function setCopyProject(projectID)
{
  location.href = createLink('project', 'create', 'productID=&projectID=0&copyProjectID=' + projectID);
}

$(function()
{
  $('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')});
  $('#begin').on('change', function()
  {
    $("#end").val('');
    $("#days").val('');
    $("input:radio[name='delta']").attr("checked",false);
  });
  $('#end').on('change', function()
  {
    $("input:radio[name='delta']").attr("checked", false);
  })

  if(typeof(currentPlanID) == 'undefined')
  {
    $('#productsBox select[id^="products"]').each(function()
    {
      var branchID = 0;
      if($(this).closest('.input-group').find('select[id^="branch"]').size() > 0)
      {
        var branchID = $(this).closest('.input-group').find('select[id^="branch"]').val();
      }
      loadPlans($(this), branchID);
    });
  }

  /* Assign value to the manage products by the different request type.*/
  var product = $('#products0');
  $(product).val(productID);
  $(product).trigger("chosen:updated");
  loadBranches($(product));

  var adjustMainCol = function()
  {
    $('.main-form .col-main').css('width', Math.max(250, Math.floor(($('#productsBox').outerWidth() - 50)/3) + 10));
  };
  adjustMainCol();
  $(window).on('resize', adjustMainCol);
});

function showTypeTips()
{
  var type = $('#type').val();
  if(type == 'ops')
  {
    $('.type-tips').show();
  }
  else
  {
    $('.type-tips').hide();
  }
}

</script>
</body>
</html>
